package cn.edu.scau.cmi.wurihua.client;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import cn.edu.scau.cmi.wurihua.entity.Student;
import cn.edu.scau.cmi.wurihua.entity.Teacher;
import cn.edu.scau.cmi.wurihua.mapper.StudentMapper;
import cn.edu.scau.cmi.wurihua.mapper.TeacherMapper;
import cn.edu.scau.cmi.wurihua.service.StudentService;
import cn.edu.scau.cmi.wurihua.service.TeacherService;
import cn.edu.scau.cmi.wurihua.util.MybatisUtil;

public class MybatisMain {
	
	
	static StudentService studentService = new StudentService();
	static TeacherService teacherService = new TeacherService();
	
	public static void main(String[] args) {
		Student student = new Student(6,"赵本山",1);
		System.out.println("增加学生："+studentService.insertService(student));
		student.setName("陈冠希");
		
		System.out.println("更新学生："+studentService.updateService(student));
		
		System.out.println("根据学号查询学生："+studentService.selectService(6));
		
		System.out.println("删除学生："+studentService.deleteService(6));
//		
		Teacher teacher = new Teacher(5,"赵忠祥");
		System.out.println("增加老师："+teacherService.insertService(teacher));
		
		teacher.setName("ikun老师");
		System.out.println("更新老师："+teacherService.updateService(teacher));
		
		System.out.println("根据工号查询老师："+teacherService.selectService(2));
		
		System.out.println("删除老师："+teacherService.deleteService(5));
		
		System.out.println("更改师生关系："+studentService.changeTutorService(4, 6));
	}
}
